{extend name="iframe" /}

{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <form action="{:request()->url()}" method="post" class="xn_ajax" data-type="open">
        <div class="layui-form-item">
            <label class="layui-form-label">行业类型</label>
            <div class="layui-input-inline">
                <select name="parent_typeid" lay-filter="parent_typeid">
                    <option value="0">选择类型</option>
                    {foreach name="parent_typelist" item="vo"}
                    <option value="{$vo.id}" {if condition="$data.parent_typeid eq $vo.id"}selected{/if} >{$vo.title}</option>
                    {/foreach}
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="typeid" id="typeid">
                    <option value="0">选择类型</option>
                    {foreach name="typelist" item="vo"}
                    <option value="{$vo.id}" {if condition="$data.typeid eq $vo.id"}selected{/if} >{$vo.title}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">位置</label>
            <div class="layui-input-inline">
                <select name="position">
                    <option value="0">请选择</option>
                    {if $Request.action=='add'}
                    <option value="1" {if $position==1}selected{/if}>靠谱|可靠</option>
                    <option value="2" {if $position==2}selected{/if}>真假</option>
                    <option value="3" {if $position==3}selected{/if}>骗局</option>
                    <option value="4" {if $position==4}selected{/if}>前景</option>
                    <option value="5" {if $position==5}selected{/if}>生意</option>
                    <option value="6" {if $position==6}selected{/if}>赔/亏</option>
                    {else}
                    <option value="1" {if $data.position==1}selected{/if}>靠谱|可靠</option>
                    <option value="2" {if $data.position==2}selected{/if}>真假</option>
                    <option value="3" {if $data.position==3}selected{/if}>骗局</option>
                    <option value="4" {if $data.position==4}selected{/if}>前景</option>
                    <option value="5" {if $data.position==5}selected{/if}>生意</option>
                    <option value="6" {if $data.position==6}selected{/if}>赔/亏</option>
                    {/if}
                </select>
            </div>
        </div> -->
        {if $Request.action=='add'}
        <input type="hidden" name="position" value="{$position}">
        {else}
        <input type="hidden" name="position" value="{$data.position}">
        {/if}
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">文章段落</label>
            {include file="tags_text" /}
            <div class="layui-input-block">
                <textarea name="content" class="layui-textarea" id="content" style="height: 200px;">{$data.content}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" lay-submit class="layui-btn">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="js"}
<script>
    var form = layui.form;
    form.on('select(parent_typeid)', function(res) { 
        $("#typeid").empty();
        if(res.value != 0){
            $.get("{:url('admin/DataType/getSonType')}?pid="+res.value,function(result){
                if(result.status){
                    $("#typeid").append(new Option('请选择',0));
                    $.each(result.data,function(index,item){
                        $("#typeid").append(new Option(item.title,item.id));
                    });
                    form.render("select");
                }
            });
        }else{
            $("#typeid").append(new Option('请选择',0));
            form.render("select");
        }
    })
</script>
{/block}